<?php if (in_array($this->subjectSn, array_keys($this->subjectData))):?>
<script>
$(function(){
$("#setForm").ajaxForm();
$(".score, .description").focus(function(){
    $(".score, .description").removeClass('focus');
    $(this).addClass('focus');
    var x = $(this).offset().top - 100; // 100 provides buffer in viewport
    $('html,body').animate({scrollTop: x}, 50);
   });
});
</script>

<form action="<?php echo $this->route('set-subject') ?>" method="post"  id="setForm" >
<table class="ui-corner-all" style="background:#acc; border:#ccc solid thin; margin:5px;padding:5px">
<thead>
<tr>
<th><?php echo $this->translate('student number')?></th>
<th><?php echo $this->translate('student name')?></th>
<th><?php echo $this->translate('semester score')?></th>
<th><?php echo $this->translate('score description')?></th>
</tr>
</thead>
<tbody>
<?php $i = 1;?>
<?php foreach($this->studentData  as $studentSn => $val):?>
<tr>
<td><?php echo $val['number']?></td>
<td><?php echo $val['name']?></td>
<td>
<input type="text" class="score" name="score[<?php echo $studentSn?>]" size="5"  tabindex="<?php echo 100+$i?>"
value="<?php if (isset($this->scoreData[$studentSn]['score'])) echo $this->scoreData[$studentSn]['score']?>" /></td>
<td>
<input type="text" class="description" name="description[<?php echo $studentSn?>]" size="50"  tabindex="<?php echo 200+$i?>"
value="<?php if (isset($this->scoreData[$studentSn]['description'])) echo $this->scoreData[$studentSn]['description']?>" /></td>
</tr>
<?php $i++;?>
<?php endforeach?>
<tr>

</tr>
</tbody>
</table>
<input type="hidden" name="yearSemester" />
<input type="hidden" name="classSn" />
<input type="hidden" name="subjectSn" />
</form>
<?php endif?>